package tw.com.jinwei.service;

import java.util.List;

import tw.com.jinwei.db.ProductCategory;
import tw.com.jinwei.db.ProductCategoryDAO;

public class ProductService {

	private ProductCategoryDAO productCategoryDao;

	public ProductCategoryDAO getProductCategoryDao() {
		return productCategoryDao;
	}

	public void setProductCategoryDao(ProductCategoryDAO productCategoryDao) {
		this.productCategoryDao = productCategoryDao;
	}

	public void addCategory(ProductCategory category) {
		productCategoryDao.save(category);
	}

	public List queryCategory(String shortcode, String spec) {
		return productCategoryDao.findByProperty(shortcode, spec);
	}

	public void updateCategory(ProductCategory category) {
		productCategoryDao.attachDirty(category);
	}

	public void deleteCategory(ProductCategory category) {
		productCategoryDao.delete(category);
	}
}
